{% extends 'base.html' %}
{% load staticfiles %}

{% block content %}

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <h2 class="sub-header">添加新时段</h2>
        <div>
            <form class="form-horizontal" method="POST" action="/room_hot">
                <div class="form-group">
                    <label for="email" class="col-sm-2 control-label">房间类型</label>
                    <div class="col-sm-5">
                        <select class="form-control" name='room_type' id="select-input">
                            <option value="1" {%if room_type == 1%}selected="selected" {%endif%}>标准间</option>
                            <option value="2" {%if room_type == 2%}selected="selected" {%endif%}>大床房</option>
                            <option value="3" {%if room_type == 3%}selected="selected" {%endif%}>商务双人间</option>
                            <option value="4" {%if room_type == 4%}selected="selected" {%endif%}>豪华大床房</option>
                        </select>
                    </div>
                    <div class="col-sm-4 tips"></div>
                </div>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">开始时间</label>
                    <div class="col-sm-5">
                        <input class="form-control"type="text" onClick="WdatePicker()" name="s_time"/>
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">结束时间</label>
                    <div class="col-sm-5">
                            <input name="e_time" class="form-control" name="endDate" onclick="WdatePicker()">
                    </div>
                    </div>
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">价格</label>
                    <div class="col-sm-5">
                        <input type="text" class="form-control" name="money" id='money'>
                    </div>
                </div>
                {% csrf_token %}
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-2">
                        <button type="submit" class="btn btn-primary">添加</button>
                    </div>
                </div>
            </form>
        </div>
    <h2 class="sub-header">高峰时段</h2>
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>房间类型</th>
                    <th>开始时间</th>
                    <th>结束时间</th>
                    <th>房价</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {%for info in infos%}
                    <tr>
                        <td>{{forloop.counter}}</td>
                        <td>
                            {% if info.type_num == 1 %}
                            标准间
                            {%elif info.type_num == 2 %}
                            大床房
                            {%elif info.type_num == 3 %}
                            商务双人间
                            {%elif info.type_num == 4 %}
                            豪华大床房
                            {%endif%}
                        </td>
                        <td>{{info.s_time|date:"Y-m-d"}}</td>
                        <td>{{info.e_time|date:"Y-m-d"}}</td>
                        <td>{{info.price}}</td>
                        <td><a type="button" class="btn btn-default bta"
                            href="/delete_hot?id={{info.id}}">删除</a>
                        </td>
                    </tr>
                {%endfor%}
            
            </tbody>
        </table>
    </div>
</div>
<script src="/static/calendar/WdatePicker.js"></script>
{% endblock%}